#pragma once
#include <QtOpengl/QGLWidget>
#include "Camera.h"

class GLCanvas:public QGLWidget
{
private:
	GLuint renderID;

public:
	GLCanvas(QWidget *parent);
	~GLCanvas(void);
	Camera camera;

public:
	QSize minimumSizeHint() const;
	QSize sizeHint() const;

	float fov;
	float ratio;
	float clipRatioFar;
	float clipRatioNear;
	float nearPlane;
	float farPlane;

	int oldx;
	int oldy;

	GGL::Point3f old;

private:
	GLuint vertexShaderID;
	GLuint fragmentShaderID;
	GLuint geometryShaderID;
	GLuint shaderID;

	void setShaders();
	void shaderCleanUp();

public:
	void closeEvent(QCloseEvent *event){};
  
protected:

	void initializeGL();

	void paintGL();
	void resizeGL(int width, int height);
	
	void keyReleaseEvent ( QKeyEvent * event ); 
	void keyPressEvent ( QKeyEvent * event ); 
	void mousePressEvent(QMouseEvent *event);
	void mouseMoveEvent(QMouseEvent *event);
	void mouseReleaseEvent(QMouseEvent *event);
	
	void wheelEvent(QWheelEvent *event);
};
